package net.mingsoft.report_data.biz.impl.report_gen;

import net.mingsoft.report_data.biz.ZkDataCityPlanningSmartSelection;
import net.mingsoft.report_data.biz.ZkDataCityOdAnalysisBiz;
import net.mingsoft.report_data.biz.ZkDataOnVacationFlowPopulationBiz;
import net.mingsoft.report_data.biz.ZkDataReportPopulationAnalysisBiz;
import net.mingsoft.report_data.enums.ReportPeriodType;
import net.mingsoft.report_data.util.PeriodUtil;
import net.mingsoft.report_data.util.ReportFtlRender;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 城市规划智能选址报告
 *
 * @author gengfa
 * @date 22/06/02
 */
@Service(value = "CITY_PLAN_SMART_SELECT")
public class ZkDataCityPlanningSmartSelectionImpl implements ZkDataCityPlanningSmartSelection {

    @Resource
    ZkDataReportPopulationAnalysisBiz populationAnalysisBiz;

    @Resource
    ZkDataOnVacationFlowPopulationBiz onVacationFlowPopulationBiz;

    @Resource
    ZkDataCityOdAnalysisBiz cityOdAnalysisBiz;

    @Resource
    FreeMarkerConfigurer configurer;

    @Override
    public String generate(ReportPeriodType periodType) {
        Map<String, Object> map = PeriodUtil.getDateArgs(periodType);

        // 人口动态分析：人口地理分布
        populationAnalysisBiz.getPopulationDistributed(map);

        // 人口动态分析：城市人口迁徙
        populationAnalysisBiz.getCityMigrationData(map);

        // 节假日人口流动分析：旅游用户趋势
        onVacationFlowPopulationBiz.getTouristTrend(map);

        // 城市通勤出行：通勤人口职住地分析
        cityOdAnalysisBiz.getOdFeatureWorkHomeData(map);

        return ReportFtlRender.render(configurer, "report/form-csghznxz.ftl", map);
    }
}
